// 时间戳转时分秒
function getformatDate (date, fmt) {
  if (/(y+)/.test(fmt)) {
      fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
  }
  let o = {
      'M+': date.getMonth() + 1,
      'd+': date.getDate(),
      'h+': date.getHours(),
      'm+': date.getMinutes(),
      's+': date.getSeconds()
  };
  for (let k in o) {
      if (new RegExp(`(${k})`).test(fmt)) {
          let str = o[k] + '';
          fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : padLeftZero(str));
      }
  }
  return fmt;
};

function padLeftZero (str) {
  return ('00' + str).substr(str.length);
};

 // 时间过滤
export function dateFormat(time) {
  return getformatDate(new Date(time), "yyyy-MM-dd hh:mm");
}

export function fixNum(txt,num = 2) {
  let val = Number(txt).toFixed(num)

  return val
}
export function statusType(status) {
  let txt = ''
  if(status == 0){
	  txt = '待确认中'
  }else if(status == 1){
	  txt = '已确认，待支付'
  }else if(status == 2){
	  txt = '取消结算'
  }else if(status == 3){
	  txt = '支付待确认'
  }else if(status == 4){
	  txt = '结算成功'
  }else if(status == 5){
	  txt = '支付失败'
  }else if(status == 4){
	  txt = '结算失败'
  }
  
  return txt
}

export function statusTypeB(status) {
  let txt = ''
  if(status == 0){
	  txt = '待接单'
  }else if(status == 1){
	  txt = '已取消'
  }else if(status == 2){
	  txt = '待服务'
  }else if(status == 3){
	  txt = '转单中'
  }else if(status == 4){
	  txt = '服务中'
  }else if(status == 5){
	  txt = '成功，待评价'
  }else if(status == 6){
	  txt = '成功，已评价'
  }else if(status == 7){
	  txt = '服务失败，待评价'
  }else if(status == 8){
	  txt = '服务失败，已评价'
  }else if(status == 9){
	  txt = '超时'
  }
  return txt
}

export function countTypeTxt(status) {
  let txt = ''
  if(status == 0){
	  txt = '签到任务'
  }else if(status == 1){
	  txt = '订单任务'
  }else if(status == 2){
	  txt = '评价任务'
  }else if(status == 3){
	  txt = '阅读任务'
  }else if(status == 4){
	  txt = '活动任务'
  }
  	
  return txt
  
}
export function TypeTxt(status) {
  let txt = ''
  if(status == 'sell'){
	  txt = '卖出废品'
  }else if(status == 'pay_product'){
	  txt = '购买商品'
  }else if(status == 'withdraw'){
	  txt = '提现'
  }else if(status == 'withdraw_return'){
	  txt = '提现回退'
  }else if(status == 'gain_comment'){
	  txt = '评论奖励'
  }else if(status == 'gain_order'){
	  txt = '下单奖励'
  }else if(status == 'gain_sign'){
	  txt = '签到奖励'
  }else if(status == 'gain_read'){
	  txt = '阅读奖励'
  }else if(status == 'gain_activity'){
	  txt = '活动奖励'
  }

  return txt
  
}
export function categoryTypeTxt(status) {
  let txt = ''
  if(status == 'now_money'){
	  txt = '资金余额'
  }else if(status == 'integral'){
	  txt = '积分余额'
  }else if(status == 'carbon'){
	  txt = '碳币余额'
  }else if(status == 'carbon_total'){
	  txt = '排碳量'
  }
  	
  return txt
  
}

export function cssType(status) {
  let txt = ''
  
  if(status == '0'){
	  txt = 'type2'
  }else if(status == '1'){
	  txt = 'type2'
  }else if(status == '2'){
	  txt = 'type3'
  }else if(status == '3'){
	  txt = 'type1'
  }else if(status == '4'){
	  txt = 'type3'
  }
  return txt
  
}

export function drawType(status) {
  let txt = ''
  
  if(status == '0'){
	  txt = '待审核'
  }else if(status == '1'){
	  txt = '转账中'
  }else if(status == '2'){
	  txt = '不通过'
  }else if(status == '3'){
	  txt = '成功'
  }else if(status == '4'){
	  txt = '失败'
  }
  console.log(txt,'txt') 	
  return txt
  
}
export function DrawpayType(status) {
  let txt = ''
  if(status == 1){
	 txt =   '支付宝支付'
  }else if(status == 2){
	  txt =  '微信支付'
  }else if(status == 3){
	  txt =  '银行卡支付'
  }
  
  return txt
}
export function categoryTypeTxt2(num,status) {
  let txt = ''
  if(status == 'now_money'){
	  txt = '￥' + num 
  }else if(status == 'integral'){
	 txt =  num + '积分'
  }else if(status == 'carbon'){
	  txt =  num + '炭币'
  }else if(status == 'carbon_total'){
	  txt =  num + '排碳量'
  }
  
  return txt
}
export function payTypeTxt(status) {
  let txt = ''
  if(status == 0){
	  txt = '余额支付'
  }else if(status == 1){
	 txt =   '微信支付'
  }else if(status == 2){
	  txt =  '支付宝支付'
  }else if(status == 3){
	  txt =  '银行卡支付'
  }
  
  return txt
}

// export formatDate(value,spe='/') {
// 				value = value*1000
//    let data= new Date(value);
//    let year = data.getFullYear();
//    let month = data.getMonth() + 1;
//    let day = data.getDate();
//    let h = data.getHours();
//    let mm = data.getMinutes();
//    let s = data.getSeconds();
//    month = month >= 10 ? month : "0" + month;
//    day = day >= 10 ? day : "0" + day;
//    h = h >= 10 ? h : "0" + h;
//    mm = mm >= 10 ? mm : "0" + mm;
//    s = s >= 10 ? s : "0" + s;
//    return `${year}${spe}${month}${spe}${day} ${h}:${mm}:${s}`;
// }
